package com.quick.config;

import com.quick.job.TestQuartz;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @ClassName QuartzConfig
 * @Description TODO
 * @Author wangxin332
 * @Date 2018/10/1 下午8:57
 * @Version 1.0
 **/
@Configuration
public class QuartzConfig {
	@Bean
	public JobDetail testQuartzDetail(){
		return JobBuilder.newJob(TestQuartz.class).withIdentity("testQuartzDetail").storeDurably().build();
	}
	@Bean
	public Trigger testQuartzTrigger(){
		SimpleScheduleBuilder simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule()
				.withIntervalInSeconds(10).repeatForever();
		return TriggerBuilder.newTrigger().forJob(testQuartzDetail()).withIdentity("testQuartzDetail")
				.withSchedule(simpleScheduleBuilder).build();
	}
}
